import curses
import time
current_milli_time = lambda: int(round(time.time() * 1000))

stdscr = curses.initscr()
height,width = stdscr.getmaxyx()

def setup():
	#curses.start_color()
	#curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)

	curses.noecho()
	curses.cbreak()
	curses.curs_set(0)
	stdscr.keypad(1)

def end():
	#reverse curses settings
	curses.nocbreak()
	stdscr.keypad(0)
	curses.echo()

	#end the curses session
	curses.endwin()
	
def progress(data):
	stdscr.move(height-1, 0)
	stdscr.clrtoeol()
	stdscr.addstr(height-1, 0, str(data))
	stdscr.refresh()

def answer(data,start_time):
	stdscr.move(height-1, 0)
	stdscr.clrtoeol()
	stdscr.addstr(height-2, 0, "Answer: "+str(data))
	stdscr.addstr(height-1, 0, "Time: "+str(current_milli_time()-start_time)+"ms")
	stdscr.refresh()
	stdscr.getch()